package com.wpy.auditlog.param;

import com.wpy.auditlog.config.AuditLogConfig;
import com.wpy.auditlog.properties.AuditProperties;
import com.wpy.auditlog.util.AuditLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

@Component
public class AuditLogInitializer {
    private final Logger logger = LoggerFactory.getLogger(AuditLogInitializer.class);
    @Autowired
    private AuditLogConfig auditLogConfig;
    @Autowired
    private AuditProperties auditProperties;

    @PostConstruct
    public void init() {
        logger.warn("AuditLogInitializer init...");
        AuditLogger.initAuditLogConfig(auditLogConfig);
        AuditParam.initAuditProperties(auditProperties);
        AuditParam.initAuditLogConfig(auditLogConfig);
        logger.warn("AuditLogInitializer init success.");
    }
}
